/********************************************
 * 功能说明: 
 * 模块名称: 
 * 系统名称: 
 * 软件版权: Frank
 * 系统版本: 1.0.0
 * 开发人员: Frank
 * 开发时间: 2019/12/12 10:40
 * 审核人员: 
 * 相关文档: 
 * 修改记录: 修改日期 修改人员 修改说明
 *********************************************/
package com.spring.arch.uaa.repository;

import com.spring.arch.uaa.model.*;
import com.spring.arch.uaa.model.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.Repository;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

/**
 * 组织人员持久层接口
 *
 * @author Frank
 * @version 1.0.0.1
 * @since 2019/12/12 10:40
 */
@org.springframework.stereotype.Repository
public interface OrganizationEmployeeRepository extends Repository<OrganizationEmployee, UUID>,
        QuerydslPredicateExecutor<OrganizationEmployee> {

    OrganizationEmployee save(OrganizationEmployee model);

    Optional<OrganizationEmployee> findById(UUID id);

    Page<OrganizationEmployee> findAll(Pageable pageable);

    void deleteById(UUID id);

    Optional<OrganizationEmployee> findByOrganizationAndEmployee(Organization organization,
                                                                 TenantEmployee tenantEmployee);

    List<OrganizationEmployee> findByEmployeeId(UUID id);

    void deleteByEmployeeId(UUID id);

    List<OrganizationEmployee> findByUserAndStatusTrue(User user);

    List<OrganizationEmployee> findByOrganizationIn(Iterable<Organization> organizations);

    void saveAll(Iterable<OrganizationEmployee> set);

    OrganizationEmployee findByEmployeeMobileAndOrganizationId(String employeeMobile, UUID orgId);

    List<OrganizationEmployee> findByOrganizationId(UUID orgId);

    List<OrganizationEmployee> findByOrganization(Organization organization);

    List<OrganizationEmployee> findByOrganizationInAndUser(Iterable<Organization> set, User user);

    Optional<OrganizationEmployee> findByOrganizationProjectAndEmployee(Project project,
                                                                        TenantEmployee tenantEmployee);

    Optional<OrganizationEmployee> findByOrganizationProjectIdAndUserId(UUID projectId, UUID userId);
}
